//
//  XLComposeBtn.swift
//  SinaWeibo
//
//  Created by 李凯 on 16/9/9.
//  Copyright © 2016年 kevin. All rights reserved.
//

import UIKit

class XLComposeBtn: UIButton {
    
    override var isHighlighted: Bool {
        set{
            
        }
        get{
            return false
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    //布局子控件
    override func layoutSubviews() {
        super.layoutSubviews()
        let width = self.frame.width
        let height = self.frame.height
        
        imageView?.frame = CGRect(x: 0, y: 0, width: width, height: width)
        titleLabel?.frame = CGRect(x: 0, y: width, width: width, height: height - width)

    }
    //设置图片居中在图片位置, 文字居中在文字位置
    func setupUI() {
        imageView?.contentMode = .center
        titleLabel?.textAlignment = .center
    }

}
